import numpy as np
from scipy.optimize import minimize

# 定义目标函数
def objective(x):
    print(x)
    return x[0]**2 + x[1]**2

# 定义约束条件
def constraint(x):
    return x[0] + x[1] - 0.1

# 初始猜测值
x0 = np.array([1.0, 1.0])

# 约束条件字典
con = {'type': 'ineq', 'fun': constraint}

# 使用 SLSQP 方法求解
sol = minimize(objective, x0, method='SLSQP', constraints=con)

print(sol)